<template>
  <div class="guess">
    <div class="container">
      <img src="https://img.zaozuo.com/3149649fce56a6a88d44cf4010460ea5" alt />
    </div>
    <van-nav-bar title="猜你喜欢" />
    <ul class="list">
      <li v-for="item in list" :key="item.pid" v-tap="{methods:detail,id:item.pid}">
        <img :src="item.pimg" alt />
        <div class="detail">
          <p class="title">{{item.pname}}</p>
          <p class="introduce">{{item.pdesc}}</p>
          <p class="price">￥{{item.pprice}}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import * as api from "@/api/getProlist.js";
export default {
  name: "guesslike",
  data() {
    return {
      list: []
    };
  },
  mounted() {
    api.getLikeProd().then(data => {
      this.list = data.data.result;
    });
  },
  methods: {
    detail(id) {
      this.$router.push("/ProdDetail?id=" + id.id);
    }
  }
};
</script>

<style scoped>
.van-ellipsis {
  font-weight: bold;
  font-size: 30px;
}
.container {
  background-color: rgb(247, 247, 247);
  width: 100%;
  height: 30vh;
  position: relative;
}
.container img {
  width: 320px;
  height: 320px;
  position: absolute;
  left: 50%;
  margin-top: 50px;
  margin-left: -160px;
}
.list {
  width: 100%;
  overflow: hidden;
  padding-bottom: 110px;
}
.list li {
  width: 49.999%;
  border: #eee solid 1px;
  box-sizing: border-box;
  float: left;
}
.list li img {
  width: 99.5%;
}
.list li .detail {
  padding-left: 20px;
}
.list li .detail p {
  margin: 0;
  line-height: 2;
}
.list li .detail p:nth-of-type(1) {
  font-weight: 600;
  font-size: 26px;
}
.list li .detail p:nth-of-type(2) {
  width: calc(100% - 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #999;
  font-size: 20px;
}
.list li .detail p:nth-of-type(3) {
  color: #666;
}
</style>